<?php

class Obj {
	public $id = false;

	function __construct($id = false) {
		$this->id = $id;
	}
	
	/**
	** Replace old format object with new
	**/
	public static function upgrade($obj) {
		$cls = get_class($obj);
		$c = new $cls();
		$arr = get_class_vars($cls);
		foreach($arr as $k => $v) {
			if(isset($obj->$k)) {
				$c->$k = $obj->$k;
			} 
		}
		DB::save($c);
		return $c;
	}
}

?>